local StoryBehavior = require("gameLogic.story.behavior.StoryBehavior")
local StoryHeroChat = class("StoryHeroChat", StoryBehavior)
local HeroChat = require("gameLogic.story.storyUI.HeroChat")

function StoryHeroChat:ctor()
    StoryHeroChat.super.ctor(self)
end

function StoryHeroChat:_active()
    if not self._heroChat then
        self._heroChat = HeroChat:create()
        local params = self:getParams()
        local hero = self:getActuator():findHero(params.heroName)
        self._heroChat:setCallback(handler(self, self._onHeroChatEnd))
        self._heroChat:updateUI(hero, params.chatId, params.duration, self:getActuator():getStoryCamera().transform)
    end
end

function StoryHeroChat:_onHeroChatEnd()
    self:setDone(true)
    printDebug("StoryHeroChat:_active() Done")
end

return StoryHeroChat
